<?php

namespace App\Http\Models;

use Illuminate\Support\Facades\Redis;

class GameCodeCacheModel
{
	
	const EXPIRES_TIME = '7200';

    // set token
	public static function add($key, $members)
	{
		$redis = Redis::connection('db_main');
		$redis->sadd($key,$members);
		return $redis->expire($key, self:EXPIRES_TIME);
	}

	// get key
	public static function smembers($key)
	{
		$redis = Redis::connection('db_main_slave');
		return $redis->smembers($key);
	}

	// delete key
	public static function del($key)
	{
		$redis = Redis::connection('db_main');
		return $redis->del($token);
	}
}

